{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 《零基础财务Python训练营》实操练习题\n",
    "## Day4《数据处理和分析（上）》"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**作业说明:**  为了帮助同学们掌握、巩固课程学习内容，并主动结合知识点思考问题逻辑，从而形成编程思维，我们为大家设计了2个不同难度的作业~\n",
    "\n",
    "▶基础题：针对当前章节传授知识点设计的题目，用于考察大家的学习掌握情况，同学们一定要尝试做出来哟~\n",
    "\n",
    "▶思考题：针对当前或近期所学内容设计的题目，用于将多个知识点串联、或是引发对后续学习内容的提前思考。同学们可能无法正确解答，但这些内容都是老师精心设计哒，目的是引发大家对知识点的深入探究~我们会有提示引导同学们思考的方向，相信这些思考会让大家不断提高自主探索的能力。\n",
    "\n",
    "★对于以上说明和作业问题，同学们可以在群里积极参与讨论或向助教老师咨询呦，相信大家只要认真完成作业，一定能够收获满满！"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.【基础题】 商品销售情况分析（运行结果截屏打卡）"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.1 数据库创建\n",
    "<br>商店店主为了提前迎接双十一盛典，想先统计一周以来店铺各类别产品的销量"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（1）创捷Series，\n",
    "<br>设置索引为：食品，数码，服装，家电，厨具，饰品，箱包，洗护，运动，保健，\n",
    "<br>对应的销量分别为340,345,678,234,567,789,457,235,467,290"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（2）创建DataFrame\n",
    "<br>设置编号code为：1021,1098,1054,1237,1369,1190,1156,1320,1221,1047\n",
    "<br>商品类别types分别为食品，数码，服装，家电，厨具，饰品，箱包，洗护，运动，保健，\n",
    "<br>对应的销量sales分别为340,345,678,234,567,789,457,235,467,290"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#拓展小知识#\n",
    "#我们发现通过index=?的方法可以直接设置索引内容，但创建完DataFrame后，有了默认的索引，我们应该如何进行重置呢？\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=#A64646 size=2> **同学们可以自己尝试一下呦，明天我们依然会用到这个代码的！**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（3）使用loc函数查看编号为1156的商品类别和销量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.2 完善操作\n",
    "<br>店主对统计后的数据进行了核查，核查后店主发现商品的平均价格忘记填写了，另外由于仓库位置有限，店主想要下架编号为1237的家电，下面我们需要进一步完善数据表"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（1）使用insert函数添加各商品的平均价格prices:60,980,124,580,98,23,87,31,167,210"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（2）使用drop函数删除code为1237的行数据\n",
    "\n",
    "<br>提示：同学们注意呦：这里我们将code设为了索引，直接drop就可以啦，不需要再加引号了哦"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.【基础题】 商店宣传渠道预览"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "数据预览\n",
    "<br>为了吸引客户，商店店主投放了四个渠道进行宣传，下面先看一下各渠道的数据情况"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（1）在python中读取作业中的excel文件，DataFrame的变量名要求为\"data\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（2）使用head预览数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（3）使用shape获取数据表大小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（4）使用info获取数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（5）使用describle获取数值分布情况"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.【思考题】 商店宣传渠道分析"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（1）求出四个渠道分别推荐用户数总和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "（2）求出四个渠道分别推荐用户数的平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#请在此输入答案并运行#\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=#A64646 size=2> **同学们真棒，看来大家已经掌握本节课的数据分析方法啦！不要忘记截图打卡呦****"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=#A64646 size=2> **继续加油喔，快和小伙伴一起开启明天的课程学习吧！**"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
